package io.closes.domain;

import java.util.Date;

public class User {
    private String username;
    private Integer money;
    private AwardItem awardItem;

    public static Date nowDate = new Date();

    public static String userSex() {
        return "male";
    }

    /**
     * 静态方法同步
     */
    public static synchronized void write() {
        try {
            System.out.println("xxxxxx");
            Thread.sleep(5000);
        } catch (Throwable throwable) {
            throwable.printStackTrace();
        }
    }

    /**
     * 实例方法同步
     */
    public  synchronized void read(){
        try {
            System.out.println("read");
            Thread.sleep(5000);
        } catch (Throwable throwable) {
            throwable.printStackTrace();
        }
    }


    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public Integer getMoney() {
        return money;
    }

    public void setMoney(Integer money) {
        this.money = money;
    }

    public AwardItem getAwardItem() {
        return awardItem;
    }

    public void setAwardItem(AwardItem awardItem) {
        this.awardItem = awardItem;
    }

    @Override
    public String toString() {
        return "User{" +
                "username='" + username + '\'' +
                ", money=" + money +
                ", awardItem=" + awardItem +
                '}';
    }

    public User(String username, Integer money, AwardItem awardItem) {
        this.username = username;
        this.money = money;
        this.awardItem = awardItem;
    }

    public User() {
    }

    public User(String username, Integer money) {
        this.username = username;
        this.money = money;
    }
}
